<template>
    <div class="container">
      <div class="tips-title">1.基础用法</div>
      <div class="tips-title-sub">页数较少时的效果</div>
      <el-pagination layout="prev, pager, next" :total="50"></el-pagination>
      <div class="tips-title-sub">大于 7 页时的效果</div>
      <el-pagination layout="prev, pager, next" :total="1000"></el-pagination>
      <div class="tips-title-sub">小型分页</div>
      <el-pagination small layout="prev, pager, next" :total="50"></el-pagination>
      <div class="tips-title-sub">带有背景色的分页</div>
      <el-pagination background layout="prev, pager, next" :total="1000"></el-pagination>
      </el-pagination>
      <div class="tips-title">2.设置最大页码按钮数</div>
      <el-pagination :page-size="50" :pager-count="11" layout="prev, pager, next" :total="1000"></el-pagination>
      <el-pagination :page-size="20" :pager-count="7" layout="prev, pager, next" :total="1000"></el-pagination>
      <div class="tips-title">3.当只有一页时隐藏分页</div>
      <el-switch v-model="switch1" active-text="隐藏" inactive-text="显示"></el-switch>
      <el-pagination :hide-on-single-page="switch1" :total="5" layout="prev, pager, next"></el-pagination>
      <div class="tips-title">4.附加功能</div>
      <div class="tips-title-sub">1) 显示总数</div>
      <el-pagination layout="total, prev, pager, next" :total="50"></el-pagination>
      <div class="tips-title-sub">2) 调整每页显示条数</div>
      <el-pagination layout="sizes, prev, pager, next" :total="1000"></el-pagination>
      <div class="tips-title-sub">3) 直接前往</div>
      <el-pagination :page-size="50" layout="prev, pager, next, jumper" :total="1000"></el-pagination>
      <div class="tips-title-sub">4) 完整功能</div>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400"></el-pagination>
    </div>
</template>
<script>
  export default {
    name: 'd-pagination',
    data() {
      return {
        switch1: true,
        currentPage: 1
      }
    },
    methods: {
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
    }
  }
</script>
<style>
</style>

